package com.zmzncs.lmtc.module.customer.controller;

import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.pojo.enums.WhetherEnum;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.customer.pojo.card.CardHasForm;
import com.zmzncs.lmtc.module.customer.service.CardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 客户-会员卡 前端控制器
 * </p>
 *
 * @author 任建波
 * @since 2020-09-02
 */
@Api(tags = "客户会员卡")
@RestController
@RequestMapping("/customer/card")
public class CardController {

    @Autowired
    CardService cardService;


    @ApiOperation(value = "是否有会员卡")
    @PostMapping(value = "/hasCustomerCard")
    public Rest hasCustomerCard(CardHasForm cardHasForm) {
        WhetherEnum whetherEnum = cardService.hasCustomerCard(cardHasForm);
        if(whetherEnum.equals(WhetherEnum.NO)){
            return RestUtil.warning("客户没有会员卡，或会员卡已到期");
        }
        return RestUtil.success();
    }

}

